Ext.namespace('RaidAssist.Dialogs');

/**
 * Opens the SKList dialog
 * Expecting the config object to contain:
 */
RaidAssist.Dialogs.skListDialog = function(config) {
	
	var skListButtons = [{
			text : 'Submit',
			handler : addOrderSubmitHandler
		}, {
			text: 'Cancel',
			handler: function() {
				// // Warn if fields have changed.
				// if (addOrderPanel.form.isDirty()) {
					// Ext.Msg.confirm('Cancel', 'Any data you have entered will be lost. Cancel?', function(btn, text){
					    // if (btn == 'yes'){
					        // addOrderWindow.close();
					    // }
					// });						
				// } else {
					skListWindow.close();
				// }
			}
		}];

	var skListPanel = new Ext.FormPanel({
		labelWidth : 110,
		bodyStyle : 'padding:5px 5px 0;position:relative;',
		items : [
            {
                xtype: 'altus-common-fieldset', 
                title: 'Order Details', 
                collapsible: false, 
                autoHeight:true, 
                defaults: {width: 400}, 
                items:[{
                        xtype: 'altus-common-textfield',
                        fieldLabel : 'Holding',
                        name : 'holdingAccName',
                        value: config.holdingName,
                        readOnly : true,
                        selectOnFocus : true
                    }, {
                        xtype: 'altus-common-textfield',
                        fieldLabel : 'Provider',
                        name : 'providerName',
                        value: config.providerName,
                        //vtype: 'holding',
                        readOnly : true,
                        selectOnFocus : true
                    }, {
                        xtype: 'altus-common-textfield',
                        fieldLabel : 'Additional Info',
                        name : 'additionalInfo',
                        value: config.additionalInfo,
                        selectOnFocus : true
                    }, {
                        xtype: 'altus-common-textfield',
                        fieldLabel : 'Batch Reference',
                        name : 'batchRef',
                        value: config.batchRef,
                        selectOnFocus : true
                    }, {
                        xtype: 'hidden',
                        name: 'holdingId',
                        value: config.holdingId,
                        hidden: true
                    },{
                        xtype: 'hidden',
                        name: 'providerId',
                        value: config.providerId,
                        hidden: true
                    }]
            },
            {
                xtype: 'altus-common-fieldset', 
                title: (config.messageType === 'switch') ? 'Instruction' : 'Instructions', 
                collapsible: false, 
                autoHeight:true,
                items: instructionControls                    
            }]
	});

	skListWindow = new Ext.Window({
		title : 'SK Lists',
		width: 550,
		autoHeight : true,
        constrain: true,
        resizable: false,
    	buttonAlign: 'center',
		closable : false,
		modal : true,
		items : addOrderPanel,
		buttons : addOrderButtons
	});
    
	skListWindow.show();
    
	// var nav = new Ext.KeyNav(addOrderWindow.getEl(), {
		// "enter" : submitHandler
	// });
};
